﻿using System;
using System.Collections.Generic;
using System.Text;
using MyTask.Domain.Commands;
using MyTask.Domain.Commands.Handlers;
using MyTask.Domain.Models;
using MyTask.Domain.Queries;
using MyTask.Domain.Queries.Handlers;

namespace MyTask.Application.Services
{
    public class UserInfoService : IUserInfoService
    {
        #region Private variable
        private UserInfoCommandHandler _userInfoCommandHandler;
        private UserInfoQueryHandler  _userInfoQueryHandler;
        #endregion
        #region Constructor
        public UserInfoService(UserInfoCommandHandler userInfoCommandHandler, 
            UserInfoQueryHandler userInfoQueryHandler)
        {
            _userInfoCommandHandler = userInfoCommandHandler;
            _userInfoQueryHandler = userInfoQueryHandler;
        }

      
        #endregion
        #region Public mthod
        /// <summary>
        /// Register a User
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        public bool Register(UserInfoCommand command)
        {
            return _userInfoCommandHandler.Register(command);
        }
        /// <summary>
        /// Get shared users by user
        /// </summary>
        /// <param name="_query"></param>
        /// <returns></returns>
        public List<UserInfo> GetSharedUsers(GetSharedUsersQuery _query)
        {
            return _userInfoQueryHandler.GetSharedUsers(_query);
        }
        /// <summary>
        /// Get user by username
        /// </summary>
        /// <param name="_query"></param>
        /// <returns></returns>
        public UserInfo GetUserInfoByUserName(GetUserInfoByUserNameQuery _query)
        {
            return _userInfoQueryHandler.GetUserInfoByUserName(_query);
        }
        /// <summary>
        /// Log in
        /// </summary>
        /// <param name="_query"></param>
        /// <returns></returns>
        public bool Login(LoginQuery _query)
        {
            return _userInfoQueryHandler.Login(_query);
        }
        #endregion
    }
}
